﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace 策略模式使用前
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Hero hero1 = new Fashi();
            Hero hero2 = new Gongjianshou();
            var heroList = new List<Hero> {hero1, hero2};
            foreach (var t in heroList)
            {
//所有英雄直接执行相应动作 如果在英雄初始化注册了动作就会执行这个动作  
                var currentHero = t;
                currentHero.showname();
                currentHero.attack();
                currentHero.move();
                currentHero.death();
            }
        }
    }
}
